// 服务器返回接口
export interface ResponseData {
  code: number
  message: string
  ok: boolean
}

// SPU数据
export interface SpuData {
  id?: number | string
  spuName: string
  description: string
  category3Id: number | string
  tmId: number | string
  spuSaleAttrList: null | SaleAttr[]
  spuImageList: null | SpuImage[]
}

// spu数据列表
export type Records = SpuData[]

// spu返回类型
export interface SpuResponseData extends ResponseData {
  data: {
    records: Records
    total: number
    size: number
    current: number
    searchCount: boolean
    pages: number
  }
}

// 品牌类型
export interface TradeMark {
  id: number
  tmName: string
  logoUrl: string
}
// 所有返回品牌类型
export interface TradeMarkResponseData extends ResponseData {
  data: TradeMark[]
}

// 图片
export interface SpuImage {
  id?: number
  imgName?: string
  imgUrl?: string
  spuId?: number
  name?: string
  url?: string
}
// 图片返回
export interface SpuImageResponseData extends ResponseData {
  data: SpuImage[]
}

// 销售属性
export interface SaleAttrValue {
  id?: number
  spuId?: number
  baseSaleAttrId: number | string
  saleAttrValueName: string
  saleAttrName?: string
  isChecked?: null
}

export type SaleAttrValueList = SaleAttrValue[]

export interface SaleAttr {
  id?: number
  baseSaleAttrId: number | string
  saleAttrName: string
  spuId?: number
  spuSaleAttrValueList: SaleAttrValueList
  flag?: boolean
  saleAttrValueName?: string
  saleAttrIdValueId?: string
}

export interface SaleAttrResponseData extends ResponseData {
  data: SaleAttr[]
}

// 所有销售属性
export interface AllSaleAttr {
  id: number
  name: string
}
export interface AllSaleAttrResponseData extends ResponseData {
  data: AllSaleAttr[]
}
